package classifiers.helper;
import java.util.Enumeration;

import weka.core.AbstractInstance;
import weka.core.Attribute;
import weka.core.Instance;
import weka.core.Instances;


public class BinaryRelevanceTransformationInstance extends AbstractInstance {

	private Instance instance;
	private Instances dataset;
	private int label_idx;
	
	public BinaryRelevanceTransformationInstance(int label_idx, Instance instance,
			Instances dataset) {
		super();
		setDataset(dataset);
		this.instance = instance;
		this.dataset = dataset;
		this.label_idx = label_idx;
		setWeight(instance.weight());
	}

	@Override
	public int index(int arg0) {
		return arg0;
	}

	@Override
	public Instance mergeInstance(Instance arg0) {
		System.err.println("ERROR METHOD NOT IMPLEMENTED: "+"mergeInstance(Instance)");
		return null;
	}

	@Override
	public int numAttributes() {
		return  dataset.numAttributes();
	}

	@Override
	public int numValues() {
		return  dataset.numAttributes();
	}

	@Override
	public void replaceMissingValues(double[] arg0) {
		System.err.println("ERROR METHOD NOT IMPLEMENTED: "+"replaceMissingValues(int,double)");
	}

	@Override
	public void setValue(int arg0, double arg1) {
		System.err.println("ERROR METHOD NOT IMPLEMENTED: "+"setValue(int,double)");	
	}

	@Override
	public void setValueSparse(int arg0, double arg1) {
		System.err.println("ERROR METHOD NOT IMPLEMENTED: "+"setValueSparse(int,double)");
	}

	@Override
	public double[] toDoubleArray() {
		System.err.println("ERROR METHOD NOT IMPLEMENTED: "+"setValueSparse(int,double)");
		return null;
	}

	@Override
	public String toStringNoWeight() {
		System.err.println("ERROR METHOD NOT IMPLEMENTED: "+"toStringNoWeight(int,double)");
		return null;
	}

	@Override
	public double value(int i) {
		if ( i == dataset.classIndex() )
			return instance.value(label_idx);
		return instance.value(i);
	}
	
	@Override
	public double valueSparse(int indexOfIndex) {
		return value(indexOfIndex);
	}

	@Override
	public Object copy() {
		return this;
	}

	@Override
	protected void forceDeleteAttributeAt(int arg0) {
		System.err.println("ERROR METHOD NOT IMPLEMENTED: "+"forceDeleteAttributeAt()");	
	}

	@Override
	protected void forceInsertAttributeAt(int arg0) {
		System.err.println("ERROR METHOD NOT IMPLEMENTED: "+"forceInsertAttributeAt()");	
	}
	
	@Override
	public double classValue() {
		return instance.value(label_idx);
	}

}
